const Sequelize = require('sequelize')

exports.modelName = 'user'; // 模型名称

exports.options = { // 表配置信息
	tableName: 't_user'
};

exports.attributes = {
	phone: {
		type: Sequelize.STRING(20),
	},
	password: {
		type: Sequelize.STRING(64),
	},
	username: {
		type: Sequelize.STRING(50),
		unique: true,
		set(val) {
			const newVal = val + '_sb'; // 所有添加的数据 name后都加上sb字符
			this.setDataValue('username', newVal);
		}
	},
	sex: Sequelize.TINYINT,
	name: Sequelize.STRING(20),
	roleId: {
		type: Sequelize.STRING(50),
	}
};
